
// import configService from '@/common/service/config.service.js'
import {
	HTTP_REQUEST_URL,
	HEADER,
	TOKENNAME
} from '@/config/app.js';
const getTokenStorage = () => {
	let token = ''
	try {
		token = uni.getStorageSync(ACCESS_TOKEN)
	} catch (e) {
		//TODO handle the exception
		console.log("getTokenStorage", token)
	}
	return token
}
/**
 * 
 */
export function uploadImage(file) {
    return new Promise((resolve, reject) => {
        uni.uploadFile({
          url: HTTP_REQUEST_URL + '/api/localStorage/uploadImage',
          filePath: file,
          name: 'file',
          header: {
            Authorization:  this.$store.state.app.token
          },
          formData: {
            'Content-Type': 'multipart/form-data;',
          },
          success: (res) => {
            console.log('---------------res',JSON.stringify(res))
           
            if (res.statusCode===200) {
             
            resolve(res.data)
              // uni.showToast({title:mg.msg,icon:'none'})
            }else{
              uni.showToast({title:mg.msg,icon:'none'})
            }
    
          }
        });
      })
}


export default {uploadImage}